<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>edit student</title>
	<link rel="stylesheet" type="text/css" href="/node_modules/bootstrap/dist/css/bootstrap.min.css">
</head>
<body>
	<div class="container">
		<div class="addStudent" style="margin-top: 20px;">
			<h1 style="padding: 20px 0px;">编辑学生</h1>
			<form action="/students/edit" method="post">
				<input type="hidden" id="showGender" value="{{ student.gender }}">
				<input type="hidden" name="id" value="{{ student.id }}">
			  <div class="form-group row">
			    <label for="inputName" class="col-sm-2 col-form-label">姓名</label>
			    <div class="col-sm-10">
			      <input type="text" class="form-control" id="inputName" placeholder="姓名" name="username" value="{{student.username}}">
			    </div>
			  </div>
			  <div class="form-group row">
			    <label for="" class="col-sm-2 col-form-label">性别</label>
			    &nbsp;&nbsp;&nbsp;
					<div class="custom-control custom-radio custom-control-inline" style="padding-top: 5px;">
					  <input type="radio" id="man" name="gender" class="custom-control-input" value="1">
					  <label class="custom-control-label" for="man"> 男 </label>
					</div>
					<div class="custom-control custom-radio custom-control-inline" style="padding-top: 5px;">
					  <input type="radio" id="woman" name="gender" class="custom-control-input" value="0">
					  <label class="custom-control-label" for="woman"> 女 </label>
					</div>
			  </div>
			  <div class="form-group row">
			    <label for="inputAge" class="col-sm-2 col-form-label">年龄</label>
			    <div class="col-sm-10">
			      <input type="number" class="form-control" id="inputAge" placeholder="年龄" name="age" min="0" max="120" value="{{student.age}}">
			    </div>
			  </div>
			  <div class="form-group row">
			    <label for="inputHobbies" class="col-sm-2 col-form-label">爱好</label>
			    <div class="col-sm-10">
			      <input type="text" class="form-control" id="inputHobbies" placeholder="爱好" name="hobbies" value="{{student.hobbies}}">
			    </div>
			  </div>
			  <br>
			  <div class="form-group row">
			    <div class="col">
			      <button type="submit" class="btn btn-primary btn-block">确定</button>
			    </div>
			  </div>
			</form>
		</div>
	</div>

	<script type="text/javascript" src="/node_modules/jquery/dist/jquery.min.js"></script>
	<script type="text/javascript">
		$(function(){
			if( $('#showGender').val() == "0"){
				$('#woman').prop('checked', true)
			} else {
				$('#man').prop('checked', true)
			}
		})
	</script>
</body>
</html>